import Vue from 'vue'
// 2018年07月01日 作者:827879040@qq.com vue全局过滤器
Vue.filter('timeFormatting', function (value) {
  if (!value) return false
  let currentData = Number(value)
  let now = new Date(currentData)
  let year = now.getFullYear()
  let month = now.getMonth() + 1
  let date = now.getDate()
  let hour = now.getHours()
  let minute = now.getMinutes()
  let second = now.getSeconds()
  let currentTime = year + '-' + month + '-' + date + ' ' + hour + ':' + minute + ':' + second
  return currentTime
})
Vue.filter('tuDou', function (value) {
  return parseInt(value) > 9 ? value : '0' + value
})

Vue.filter('checkNumber', function (value) {
  let currentUrl = ''
  if (value) {
    if (value === 'A') {
      currentUrl = 'X2'
    }
    if (value === 'P') {
      currentUrl = 'X10'
    }
    if (value === 'C') {
      currentUrl = 'X50'
    }
    if (value === 'W') {
      currentUrl = 'X5'
    }
    if (value === 'B') {
      currentUrl = 'X20'
    }
    if (value === 'N') {
      currentUrl = ''
    }
    return currentUrl
  }
})
Vue.filter('checkSrc', function (value) {
  let currentUrl = ''
  if (value) {
    if (value === 'A') {
      currentUrl = 'https://www.artup.com/img/mp4/game3.png'
    }
    if (value === 'P') {
      currentUrl = 'https://www.artup.com/img/mp4/game1.png'
    }
    if (value === 'C') {
      currentUrl = 'https://www.artup.com/img/mp4/game2.png'
    }
    if (value === 'W') {
      currentUrl = 'https://www.artup.com/img/mp4/game4.png'
    }
    if (value === 'B') {
      currentUrl = 'https://www.artup.com/img/mp4/game5.png'
    }
    if (value === 'N') {
      currentUrl = 'https://www.artup.com/img/mp4/game0.png'
    }
    return currentUrl
  }
})
